<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$op = $_GPC['op'] ?? 'display';
if ($op == 'display') {
    $where = "where uniacid =" . $_W['uniacid'];
    if ($_GPC['keywords']) {
        $op = $_GPC['keywords'];
        $where .= " and title LIKE  '%$op%' or phone like '%$op%'";
    }

    $page = max(1, intval($_GPC['page']));
    $size = intval($_GPC['psize']) ? intval($_GPC['psize']) : 10;
    $sql = 'SELECT * FROM ' . tablename('yzzc_sun_user_feedback') . "{$where} ORDER BY id DESC LIMIT " . (($page - 1) * $size) . ',' . $size;

    $info = pdo_fetchall($sql);
    foreach ($info as $key => $value) {
        $info[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
    }
    $total = pdo_fetchcolumn("select count(*) from " . tablename("yzzc_sun_user_feedback") . $where);
    $pager = pagination($total, $page, $size);
    include $this->template('web/facebook');
} elseif ($op == 'delete') {
    $res = pdo_delete('yzzc_sun_store', array('store_id' => $_GPC['id']));
    if ($res) {
        message('操作成功', $this->createWebUrl('storelist', array()), 'success');
    } else {
        message('操作失败', '', 'error');
    }
}
